/* 全局样式变量 */
:root {
    --primary-color: #4a90e2;
    --secondary-color: #5eb7f7;
    --background-color: #f5f7fa;
    --box-background: #ffffff;
    --text-color: #333333;
    --border-color: #e1e4e8;
    --success-color: #28a745;
    --error-color: #dc3545;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --slider-background: #ddd;
    --slider-fill-color: var(--primary-color);
}

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
        Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    padding-bottom: 2rem;
}

/* 页眉样式 */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0.9;
}

/* 主内容区域 */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* 上传区域样式 */
.upload-container {
    margin-bottom: 2rem;
}

.upload-box {
    background-color: var(--box-background);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-box:hover, .upload-box.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(74, 144, 226, 0.05);
}

.upload-box i {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-box h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.upload-button {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    margin: 1rem 0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.upload-button:hover {
    background-color: var(--secondary-color);
}

.note {
    font-size: 0.9rem;
    color: #666;
    margin-top: 1rem;
}

/* 压缩区域样式 */
.compression-container {
    background-color: var(--box-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

/* 图片预览区域 */
.image-preview-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.preview-box {
    text-align: center;
}

.preview-box h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.preview-wrapper {
    background-color: #f0f2f5;
    border-radius: var(--border-radius);
    overflow: hidden;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23e0e0e0' fill-opacity='0.4' fill-rule='evenodd'%3E%3Cpath d='M0 20L20 0h10L0 30z'/%3E%3Cpath d='M20 40L40 20v10L30 40z'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 30px 30px;
}

.preview-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-info {
    text-align: left;
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 0.5rem;
    background-color: #f0f2f5;
    border-radius: 4px;
}

/* 控制区域样式 */
.compression-controls {
    background-color: #f0f2f5;
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.control-group {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.control-group label {
    min-width: 120px;
    margin-right: 1rem;
}

.slider {
    flex-grow: 1;
    height: 8px;
    -webkit-appearance: none;
    background-color: var(--slider-background);
    border-radius: 4px;
    outline: none;
    position: relative;
}

/* 为不同浏览器设置滑块填充颜色 */
/* Chrome/Safari/Edge */
.slider::-webkit-slider-runnable-track {
    background: var(--slider-background);
    height: 8px;
    border-radius: 4px;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background-color: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    margin-top: -6px; /* 调整垂直位置 */
    position: relative;
    z-index: 2;
}

/* Firefox */
.slider::-moz-range-track {
    background: var(--slider-background);
    height: 8px;
    border-radius: 4px;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background-color: var(--primary-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.slider::-moz-range-progress {
    background-color: var(--slider-fill-color);
    height: 8px;
    border-radius: 4px;
}

/* IE/Edge */
.slider::-ms-track {
    background: transparent;
    border-color: transparent;
    color: transparent;
    height: 8px;
}

.slider::-ms-fill-lower {
    background-color: var(--slider-fill-color);
    border-radius: 4px;
}

.slider::-ms-fill-upper {
    background-color: var(--slider-background);
    border-radius: 4px;
}

.slider::-ms-thumb {
    width: 20px;
    height: 20px;
    background-color: var(--primary-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    margin-top: 0;
}

/* 为所有浏览器添加渐变背景（JavaScript动态设置） */
.slider-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 8px;
    background-color: var(--slider-fill-color);
    border-radius: 4px 0 0 4px;
    pointer-events: none;
}

.control-group span {
    margin-left: 1rem;
    min-width: 50px;
}

input[type="number"] {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    width: 120px;
}

select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: white;
    width: 120px;
}

/* 按钮样式 */
.buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.primary-button {
    background-color: var(--primary-color);
    color: white;
}

.primary-button:hover {
    background-color: var(--secondary-color);
}

.secondary-button {
    background-color: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.secondary-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-button:not(:disabled):hover {
    background-color: rgba(74, 144, 226, 0.1);
}

.text-button {
    background-color: transparent;
    color: var(--text-color);
    text-decoration: underline;
    padding: 0.75rem 0;
}

.text-button:hover {
    color: var(--primary-color);
}

/* 页脚样式 */
footer {
    text-align: center;
    color: #666;
    padding: 2rem 1rem;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .image-preview-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .control-group {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .control-group label {
        margin-bottom: 0.5rem;
    }
    
    .buttons {
        flex-direction: column;
    }
    
    button {
        width: 100%;
    }
} 